<template>
  <div class="top-container">
    <!-- 左侧的布局 -->
    <div class="left-box">
      <div class="icon-wrapper">
        <el-tag plain>安</el-tag>
      <el-tag type="success">哥</el-tag>
      <el-tag type="info">的</el-tag>
      <el-tag type="warning">音</el-tag>
      <el-tag type="danger">乐</el-tag>
      </div>
      <div class="history-wrapper">
        <span class="iconfont icon-arrow-lift" @click="$router.back()"></span>
        <span class="iconfont icon-arrow-right"></span>
      </div>
    </div>
    <!-- 右侧的布局 -->
    <div class="right-box">
      <div class="el-input el-input--small el-input--prefix">
        <input
          type="text"
          autocomplete="off"
          placeholder="搜索"
          class="el-input__inner"
          v-model="keyword"
          @keyup.enter="sendMsg"
        />
        <span class="el-input__prefix">
          <i class="el-input__icon el-icon-search"></i>
        </span>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'top',
    data() {
      return {
        keyword:''
      }
    },
    methods: {
    async sendMsg(){
         if(this.keyword===''){
           return this.$message.warning("请输入内容")
         }
        // https://music.163.com/weapi/search/suggest/web?csrf_token=
         this.$router.push({
           name:'result',
           query:{
             id:this.keyword
           }
         })
      }
    },
  }
</script>

<style scoped>
.top-container{
  background-color: rgba(250, 250, 250, .5);
}

</style>
